package com.lzs.adx.web.modules.job.task;

import com.lzs.adx.web.modules.adx.dto.AccountReportDayDTO;
import com.lzs.adx.web.modules.adx.dto.AccountReportMonthDTO;
import com.lzs.adx.web.modules.adx.service.AccountReportDayService;
import com.lzs.adx.web.modules.adx.service.AccountReportMonthService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import java.util.List;

/**
 * 月账单
 */
@Component
@Slf4j
public class MonthReportTask implements ITask{

    @Autowired
    private AccountReportDayService accountReportDayService;

    @Autowired
    private AccountReportMonthService accountReportMonthService;

    @Override
    public void run(String params) {
        List<AccountReportMonthDTO> accountReportDayDTO = accountReportDayService.selectMonthReportData();
        for (AccountReportMonthDTO accountReportMonthDTO : accountReportDayDTO) {
            accountReportMonthDTO.setType(1);
            accountReportMonthService.generateData(accountReportMonthDTO);
        }

    }
}
